
<table class="table table-bordered">
	<thead><tr style="background:#F5F5F5"><td>分组名称</td><td width=80>操作</td></tr></thead>
	<tbody>
		<volist name="group" id="vo">
			<tr><td><input type="text" value="{$vo.group_name}" disabled style="text-align:center" class="name{$vo.id}"></td><td><span class="label label-important label-control{$vo.id}" style="cursor:pointer" id="{$vo.id}" onclick="edit_true(id,'__APP__/Contacts/changeGroup');">修改</span><span class="label label-important" style="margin-left:5px;cursor:pointer">删除</span></td></tr>
		</volist>
		<tr><td colspan="2">分组名称<input type="text"/><input type="submit" class="btn" value="添加"></td></tr>
	</tbody>
</table>
<script>
	//设置编辑状态为disabled=false
	function edit_true(id,url){
		if($('.label-control'+id).html() == '修改'){
			$(".name"+id).attr('disabled',false);
			$('.label-control'+id).removeClass('label-important').toggleClass('label-info').html('保存');
			return;
		}
		$.getJSON(url,{group_name:$(".name"+id).val()},function(json){
			if(json.status == 1){
				$(".name"+id).attr('disabled',true);
			}else{
				$.warn('错误提示',json.info);
			}
		});
	}
</script>